home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Programming / AMOSList / AMOSLIST / text0130.txt < prev    next >
Encoding:
Text File  |  1998-04-01  |  1.7 KB  |  68 lines

  1. Garfield Benjamin (gbenjam@sosbbs.com) wrote:
  2.  
  3. >AMOS currently allows you to use the If conditional in a structured
  4. >manner:
  5. >   If AGE<10 
  6. >      Print "You are less than 10 years old."
  7. >   End If
  8. >   If AGE=21
  9. >      Print "Hey!! Now you can drink alcohol in the U.S.!!"
  10. >   End If
  11. >   If AGE>21
  12. >      Print "WOW, You're OVER 21!!!"
  13. >   End If
  14.  
  15. or
  16.  
  17. >   If AGE<10 
  18. >      Print "You are less than 10 years old."
  19. >   Else
  20. >      If AGE=21
  21. >         Print "Hey!! Now you can drink alcohol in the U.S.!!"
  22. >      Else
  23. >         If AGE>21
  24. >            Print "WOW, You're OVER 21!!!"
  25. >         End If
  26. >      End If
  27. >   End If
  28.  
  29. As a substitute for select...case I don't think either is good. They're both
  30. messy. Try this instead:
  31.  
  32. If AGE<10
  33.     Print "You are less than 10 years old."
  34. else if AGE=21
  35.     print "Hey!! Now you can drink alcohol in the U.S.!!"
  36. else
  37.     print "WOW, you're OVER 21!!"
  38. endif
  39.  
  40. Smallest, and tidiest in my humble opinion.
  41.  
  42. >   Looks like AMOS needs support for those Select Cases as they
  43. >   give the best of both worlds: clarity and maximum speed. :-)
  44.  
  45. Is my approach good enough in the meantime? Hey, even old GFA-BASIC
  46. had select...case. It's quite handy at times since you could have like
  47. this for instance
  48.  
  49. select age
  50.  
  51. case 10,11-13,18
  52.  
  53. Print "You're at an age where something exciting's going to happen to you"
  54.  
  55. case 80
  56.  
  57. Print "You're older than when most people die".
  58.  
  59. ---
  60. Look at the shoes you're filling, look at the blood we're spilling
  61. Look at the world we're killing, the way we've always done before
  62. Look at the doubt we've wallowed, look at the leaders we've followed
  63. Look at the lies we've swallowed and I don't wanna hear no more
  64. ---
  65. Don't worry if it doesn't work right. If everything did, you'd be out of a job.
  66.  
  67.  
  68.